<?php

require_once 'include.php';

use sdk\WeiXin;

$swx = new WeiXin($serverAppName, $serverAppId, $serverAppSecret);

$code = $_GET["code"];
$state = $_GET["state"];

$openid = $swx->getOauthOpenid($code);

$profile = $swx->getProfile($openid);

echo $profile->nickname;